package com.nl.controller.web.controller;

import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.nl.controller.web.service.MeteorologicalStateChangeService;

import lombok.extern.slf4j.Slf4j;

@RestController
@Slf4j
@RequestMapping("meteorological")
public class MeteorologicalStateChangeController {
	 @Autowired
	 private MeteorologicalStateChangeService meteorologicalStateChangeService;
	 /**
	  * desc:气象局任务状态变更接口
	  * @author qp
	  * @param stateChangeList
	  * @return
	  */
	 @RequestMapping(value = "/meteorologicalStatestateChange")
	 public Map<String, Object> meteorologicalStatestateChange(
			 //@RequestParam(value = "stateChangeList", required = true) String stateChangeList){
			 HttpServletRequest request
			 ){
		 InputStream in;
		 String reqJson="";
		try {
			in = request.getInputStream();
			reqJson = IOUtils.toString(in, "utf-8");
			log.info("stateChangeList:"+reqJson);
		} catch (IOException e) {
			e.printStackTrace();
			log.error(e.toString());
		}
		Map<String, Object> map = meteorologicalStateChangeService.meteorologicalStateChange(reqJson/*stateChangeList*/);
		log.info("【气象局项目状态接口】返回数据：{}", map);
		return map;
	 }	 
}



